//! Main entry point for the Cangjie parser example

use cangjie_parser::lexer::Lexer;

fn main() {
    // Simple Cangjie code to parse
    let sample_code = r#"
package sample.test

import std.io.*

public class Person {
    var name: String
    var age: Int32
    
    init(name: String, age: Int32) {
        this.name = name
        this.age = age
    }
    
    public func greet(): String {
        return "Hello, my name is ${this.name} and I am ${this.age} years old."
    }
}

public func main(): Unit {
    let person = Person("Alice", 30)
    print(person.greet())
}
"#;

    println!("=== SAMPLE CODE ===");
    println!("{}", sample_code);

    // Tokenize the code
    println!("\n=== TOKENIZING ===");
    let mut lexer = Lexer::new(sample_code);
    let tokens = lexer.tokenize();

    println!("Generated {} tokens", tokens.len());

    // Print first 10 tokens
    println!("\nFirst 10 tokens:");
    for (i, token) in tokens.iter().enumerate().take(10) {
        println!("{}:{} - {:?} = \"{}\"", token.line, token.column, token.token_type, token.value);
    }

    // Parse the tokens (when parser is implemented)
    println!("\n=== PARSING ===");
    println!("Parser not yet implemented. Coming soon!");

    /*
    // When parser is implemented:
    let parser = Parser::new(tokens);
    match parser.parse() {
        Ok(ast) => {
            println!("Parsing successful!");
            // Process the AST
        }
        Err(e) => {
            println!("Error parsing: {}", e);
        }
    }
    */
}